home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: tmai.com!usenet
- From: Sridhar Panchapakesan <sridharp>
- Subject: Question on 'getopt'
- X-Nntp-Posting-Host: 205.159.65.69
- Content-Type: multipart/mixed;
- boundary="-------------------------------2173251921750221131617587270"
- Message-ID: <1996Feb5.225706.10082@tmai.com>
- Sender: usenet@tmai.com (usenet acct for news)
- Organization: TMA, Inc.
- Mime-Version: 1.0
- Date: Mon, 5 Feb 1996 22:57:06 GMT
- X-Mailer: Mozilla 1.1 (X11; U; SunOS 4.1.4 sun4m)
- X-Url: file: /usr0/home/sridharp/work/misc/querieUnix
-
- This is a multi-part message in MIME format.
-
- ---------------------------------2173251921750221131617587270
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
-
- --
-
- -----------------------------------------------------------------------------
- sridhar panchapakesan, member of technical staff
- e-mail: sridhar_panchapakesan@tmai.com
- phone : (415) 856-8862 x279 fax : (415) 856-8860
- technology modeling associates, inc. (http://www.tmai.com)
- __o
- _ \<,_
- (*)/ (*)
- ----- Save Earth
- -----------------------------------------------------------------------------
-
- ---------------------------------2173251921750221131617587270
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain
-
-
- I am trying to use 'getopt' to read a quoted string as options for a
- program. It works fine when I try it from a shell (csh) but when I try
- running it from a script using 'exec' it does not accept the entire the
- entire quoted string as the option.
-
- e.g. ( test is the program name)
- % test -f "-g -o 5" in.txt
- ( getopt works fine. The string "-g -o 5" is read correctly into
- optargs. Note that I have to use '-' (dash) in the string as a
- requirement of the program itself.)
-
- However when I try it from the script file:
-
- exec test -f "\"-g -o 5\"" in.txt
-
- The getopt only recognizes "-g as the option for -f instead of "-g -o
- 5".
-
- I would appreciate any help in this area..
-
- - Sridhar.
-
-
- ---------------------------------2173251921750221131617587270--
-